package com.vansoftwaredesign.widgetlibrary;

import android.content.Context;
import android.widget.Toast;

//basic class to provide some configuration of the widget library

//methods
//isDebug() - returns boolean true/false if we should mark we are in debug mode
//toast(String mesg, Context context) - void return, provide a easy method to call toast
//toast(String mesg, Context context,[true|false]) - void return, true provides short toast, false long toast

public class WidgetConfig {
	
	//class tag
	private static final String TAG = "WidgetConfig";
	
	//set this flag if you are in debug mode
	private static final boolean DEBUG = true;
	
	public WidgetConfig() {
		
	}
	
	//provide a global toast method
	public void toast(String mesg, Context appctx){
		longToast(mesg,appctx);
	}
	
	//allow short/long toast
	public void toast(String mesg, Context appctx, boolean shortMesg) {
		if(shortMesg) {
			shortToast(mesg,appctx);
		}
		else {
			longToast(mesg,appctx);
		}
	}
	
	//short toast
	public void shortToast(String mesg, Context appctx){
		Toast.makeText(appctx, mesg, Toast.LENGTH_SHORT).show();
	}
	
	//long toast
	public void longToast(String mesg, Context appctx) {
		Toast.makeText(appctx, mesg, Toast.LENGTH_LONG).show();
	}
	
	//return if we are in debug mode
	public boolean inDebugMode(){
		return DEBUG;
	}
	
	//print a string to determine debug mode
	public String toString(){
		
		if(inDebugMode()) {
			return "In debug mode";
		}
		else {
			return "Not in debug mode";
		}
	}

}
